package com.yujie.controller;

import com.yujie.domain.VerifyCodeInfo;
import com.yujie.util.R;
import com.yujie.util.VerifyCodeUtil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class CommonController {

    /**
     * 返回base64格式图片
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping("/vc")
    public R createVerifyCode(HttpServletRequest request, HttpServletResponse response) throws Exception {
        VerifyCodeInfo v=VerifyCodeUtil.createVerifyCode(request);
        return R.ok().setData(v);
    }




}